# Maintainer: Bruno Pagani <archange@archlinux.org>

pkgname=libfabric
pkgver=1.18.2
pkgrel=1
pkgdesc="User-space API for OpenFabrics Interfaces (OFI)"
arch=(loong64 x86_64)
url="https://ofiwg.github.io/libfabric/"
license=(GPL2)
depends=(glibc gcc-libs numactl)
options=(!lto)
source=(https://github.com/ofiwg/libfabric/releases/download/v${pkgver}/libfabric-${pkgver}.tar.bz2)
sha512sums=('18f19fd02f3c8a61224d801e6be2ca9365af141ab6a55c66a7c45c7960af1538ec097645708d877bd46558a8a588357acc596a3c71358a3e0b6c45f3f91aaab7')

prepare() {
  cd ${pkgname}-${pkgver}
  autoreconf -fvi
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make test
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
